@import '../variables.css';

.accordion {
  width: 100%;
}

.disabled {
  /* Doing this math since the SAS pane has padding that surrounds Accordions
     and makes the disabled background-color not run to the edges. These rules
     could become an issue if disabled Accordions become used with a parent
     that does not use major-padding. */
  margin-left: calc(0 - var(--gutter));
  padding-left: var(--gutter);
  width: calc(100% + (2 * var(--gutter)));
  background-color: var(--color-fill-disabled);
}

/**
 * Header
 */

.headerWrapper {
  width: 100%;
  display: flex;
  align-items: center;
  border-top: 1px solid transparent;

  & button,
  & a,
  & h1,
  & h2,
  & h3,
  & h4,
  & h5,
  & h6 {
    margin: 0;
  }

  &:focus {
    outline: none;
  }
}

.hasSeparator .headerWrapper {
  border-top: 1px solid var(--color-border-p2);
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.disabled .header {
  opacity: 0.5;
}

/**
 * Label
 */
.labelArea {
  display: flex;
  flex-grow: 2;
  font-weight: var(--text-weight-bold);
  justify-content: flex-start;
  color: var(--color-text);
}

/**
 * Content
 */
.content {
  max-height: 0; /* hidden */
  overflow: hidden;
  transition: max-height 0.25s ease;
  width: 100%;

  &.expanded {
    flex: 1;
    min-height: 0;
    max-height: none; /* max-height applied inline */
    overflow: visible;
    margin: 0 0 1em 0;
  }
}

.separator {
  width: 100%;
  border-bottom: 1px solid var(--color-border-p2);
  margin: 8px auto;
}

/**
 * Default Accordion Header
 */

.header.default {
  flex-basis: 100%;
}

.headerDefaultContentRight {
  display: flex;
  align-items: center;
  flex-grow: 2;
  flex-shrink: 0;
  padding: 0 0 0 1.2rem;
}

[dir="rtl"] .headerDefaultContentRight {
  padding: 0 1.2rem 0 0;
}

.defaultCollapseButton {
  composes: interactionStylesControl from "../sharedStyles/interactionStyles.css";
  flex: 1;
  border: none;
  outline: none;
  display: flex;
  align-items: center;
  padding: var(--gutter-static-one-third) 0;
  background-color: transparent;
  width: 100%;
  color: var(--color-text);
  font-size: var(--font-size-large);

  &:hover,
  &:focus {
    opacity: 0.85;
  }
}

.headerInner {
  composes: interactionStyles boxOffsetStartMedium boxOffsetEndMedium from "../sharedStyles/interactionStyles.css";
  width: 100%;
  display: flex;
  align-items: center;
}

/**
 * Filter set header
 */
.filterSetHeader {
  composes: interactionStyles boxOffsetStartMedium from "../sharedStyles/interactionStyles.css";
  composes: header;
  border-radius: var(--radius);
  appearance: none;
  background: none;
  border: none;
  padding: var(--input-vertical-padding) 0;
  width: 100%;
  line-height: var(--line-height);
  text-align: left;
  font-size: var(--font-size-medium);
  min-height: var(--control-min-size-desktop);

  &:focus {
    outline: none;
  }

  & .labelArea {
    padding-left: 0.25em;
    color: var(--color-text);
  }
}

.defaultHeaderIcon {
  color: var(--color-icon);
  padding: 0.25rem 0.25rem 0.25rem 0;
}

[dir="rtl"] .defaultHeaderIcon {
  padding: 0.25rem 0 0.25rem 0.25rem;
}

.filterSetHeaderIcon {
  fill: var(--color-icon);
}

[dir="rtl"] .filterSetHeaderIcon {
  margin-left: 0.35em;
}

.clearButtonVisible {
  composes: boxOffsetEndSmall from "../sharedStyles/interactionStyles.css";
  width: auto;
}

.filterSetlabel {
  color: var(--color-text);
  pointer-events: none;
  user-select: none;
}
